package executor

import (
	"gitee.com/YunFeiGuoJi/golearning/pkg/util/manager"
	log "github.com/sirupsen/logrus"
)

type Executor struct {
	ObjName            string
	Logger             *log.Logger
	SourcesDir         string
	CurrentDir         string
	Debug              bool
	SkipCheck          bool
	SkipPullImages     bool
	DeployLocalStorage bool
	AddImagesRepo      bool
	InCluster          bool
	DownloadCommand    func(path, url string)
}

func NewExecutor(logger *log.Logger, sourcesDir string, currentDir string) *Executor {
	return &Executor{
		Logger:         logger,
		SourcesDir:     sourcesDir,
		CurrentDir:     currentDir,
	}
}

func (executor *Executor) CreateManager() (*manager.Manager, error) {
	mgr := &manager.Manager{}
	mgr.Logger = executor.Logger
	mgr.Debug = executor.Debug
	mgr.SkipCheck = executor.SkipCheck
	mgr.SkipPullImages = executor.SkipPullImages
	mgr.SourcesDir = executor.SourcesDir
	mgr.AddImagesRepo = executor.AddImagesRepo
	mgr.ObjName = executor.ObjName
	mgr.InCluster = executor.InCluster
	mgr.CurrentDir = executor.CurrentDir
	mgr.DeployLocalStorage = executor.DeployLocalStorage
	return mgr, nil
}




